package gwtmodule1.client.gui.stock;

import gwtmodule1.client.gui.utils.FormTable;
import gwtmodule1.client.gui.utils.FrameClient;
import gwtmodule1.client.gui.utils.Title;

import com.google.gwt.user.client.ui.TextArea;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class PageEditSubcategory extends VerticalPanel implements FrameClient {

	private Widget createForm() {
		FormTable table = new FormTable();
		table.addInput("Name", new TextBox());
		table.addInput("Description", new TextArea());
		table.addButton("Save", null);
		return table;
	}

	private Title title = new Title("Edit/Create Subcategory");

	public PageEditSubcategory() {
		super();
		add(title);
		add(createForm());
	}

	public void onShow(Object param) {
		int id = ((Integer) param).intValue();
		title.setTitle((id == 0) ? "Create Subcategory" : "Edit Subcategory");
	}
}
